// JavaScript Document

/*
*	hardwareTest Form Validation
*	Author: Adam Fernandes
*	Created: June 22, 2008
*
*/


var errorMessage = "";

// new wrapper object
// var ap = new Object();


function ipTest(ip)
{
	var filter = /^([1-9][0-9]{0,2})+\.([1-9][0-9]{0,2})+\.([1-9][0-9]{0,2})+\.([1-9][0-9]{0,2})+$/;
	if (filter.test(ip)){
		return true;
	} else {
		document.getElementById("results").value = "Invalid IP";
		return false;
	}
}

function validate(frm)
{
	return ipTest(frm.ipAddress.value);
}

// utility functions

function isInteger(s)
{   var i;
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}


